home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
System Booster
/
System Booster.iso
/
Commodities
/
KeyClick
/
src
/
window.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-09-26
|
5KB
|
153 lines
/*
* Source generated with GadToolsBox V1.3
* which is (c) Copyright 1991,92 Jaba Development
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#include <intuition/classes.h>
#include <intuition/classusr.h>
#include <intuition/imageclass.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/gadtools.h>
#include <proto/graphics.h>
#include <string.h>
#include "window.h"
extern LONG click_vol, click_freq, click_on;
struct Screen *Scr = NULL;
APTR VisualInfo = NULL;
struct Window *ClickWnd = NULL;
struct Gadget *ClickGList = NULL;
struct Gadget *ClickGadgets[4];
UWORD ClickLeft = 268;
UWORD ClickTop = 15;
UWORD ClickWidth = 311;
UWORD ClickHeight = 37;
UWORD ClickZoom[4] = { 268, 15, 150, 0};
UBYTE *ClickWdt = (UBYTE *)"KeyClick";
struct TextAttr topaz8 = {
( STRPTR )"topaz.font", 8, 0x00, 0x00 };
int SetupScreen( void )
{
if ( ! ( Scr = LockPubScreen((UBYTE * )"Workbench" )))
return( 1L );
if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
return( 2L );
return( 0L );
}
void CloseDownScreen( void )
{
if ( VisualInfo ) {
FreeVisualInfo( VisualInfo );
VisualInfo = NULL;
}
if ( Scr ) {
UnlockPubScreen( NULL, Scr );
Scr = NULL;
}
}
int OpenClickWindow( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD offx, offy;
offx = Scr->WBorLeft;
offy = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
ClickZoom[3] = offy;
if ( ! ( g = CreateContext( &ClickGList )))
return( 1L );
ng.ng_LeftEdge = offx + 87;
ng.ng_TopEdge = offy + 2;
ng.ng_Width = 171;
ng.ng_Height = 9;
ng.ng_GadgetText = (UBYTE *)"Volume";
ng.ng_TextAttr = &topaz8;
ng.ng_GadgetID = GD_Vol;
ng.ng_Flags = PLACETEXT_LEFT;
ng.ng_VisualInfo = VisualInfo;
g = CreateGadget( SLIDER_KIND, g, &ng, GTSL_Max, 64, GTSL_Level, click_vol, GTSL_MaxLevelLen, 4, GTSL_LevelFormat, "%4ld", GTSL_LevelPlace, PLACETEXT_RIGHT, PGA_Freedom, LORIENT_HORIZ, GA_Immediate, TRUE, TAG_DONE );
ClickGadgets[ 0 ] = g;
ng.ng_TopEdge = offy + 11;
ng.ng_GadgetText = (UBYTE *)"Frequency";
ng.ng_GadgetID = GD_Freq;
g = CreateGadget( SLIDER_KIND, g, &ng, GTSL_Min, 100, GTSL_Max, 2400, GTSL_Level, click_freq, GTSL_MaxLevelLen, 1000, GTSL_LevelFormat, "%4ld", GTSL_LevelPlace, PLACETEXT_RIGHT, PGA_Freedom, LORIENT_HORIZ, GA_Immediate, TRUE, TAG_DONE );
ClickGadgets[ 1 ] = g;
ng.ng_TopEdge = offy + 22;
ng.ng_GadgetText = (UBYTE *)"Keyclick";
ng.ng_GadgetID = GD_Toggle;
g = CreateGadget( CHECKBOX_KIND, g, &ng, GTCB_Checked, click_on ? TRUE : FALSE, TAG_DONE );
ClickGadgets[ 2 ] = g;
ng.ng_LeftEdge = offx + 119;
ng.ng_Width = 139;
ng.ng_Height = 11;
ng.ng_GadgetText = (UBYTE *)"Save settings";
ng.ng_GadgetID = GD_Save;
ng.ng_Flags = PLACETEXT_IN;
g = CreateGadget( BUTTON_KIND, g, &ng, TAG_DONE );
ClickGadgets[ 3 ] = g;
if ( ! g )
return( 2L );
if ( ! ( ClickWnd = OpenWindowTags( NULL,
WA_Left, ClickLeft,
WA_Top, ClickTop,
WA_Width, ClickWidth,
WA_Height, ClickHeight + offy,
WA_IDCMP, SLIDERIDCMP|CHECKBOXIDCMP|BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH,
WA_Gadgets, ClickGList,
WA_Title, ClickWdt,
WA_ScreenTitle, "KeyClick v1.0 © Martin W. Scott, 1992.",
WA_Zoom, ClickZoom,
TAG_DONE )))
return( 4L );
GT_RefreshWindow( ClickWnd, NULL );
return( 0L );
}
void CloseClickWindow( void )
{
if ( ClickWnd ) {
CloseWindow( ClickWnd );
ClickWnd = NULL;
}
if ( ClickGList ) {
FreeGadgets( ClickGList );
ClickGList = NULL;
}
}